package co.th.bjc.md.process.service;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

public class CallService {
	
	private static XmlBeanFactory xmlBeanFactory = null;
	private static Logger _log = Logger.getLogger(CallService.class);
	
	public static void getInstance(){
		try{
		if (xmlBeanFactory == null){
			
			ClassPathResource resorce = new ClassPathResource("ApplicationConfig.xml");
			xmlBeanFactory = new XmlBeanFactory(resorce);
		}
		}catch(Exception ex){
			_log.info(ex.getMessage());
			ex.printStackTrace();
		}
	}
	
	public static Object getService(String serviceName){
		return xmlBeanFactory.getBean(serviceName);
	}

}
